package cn.centec.service;

import cn.centec.bid.entity.*;
import cn.centec.bid.util.Centec6BidReceiveHandler;
import cn.centec.core.entity.Result;
import cn.centec.core.util.JsonUtil;
import cn.centec.entity.StandardSupplyCreateParamImpl;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 接收测试
 *
 * @author 延晓磊
 * @since 2023年01月09日
 */
@Component("centec6BidReceiveHandler")
public class Centec6BidReceiveHandlerImpl extends Centec6BidReceiveHandler {

    /**
     * 创建报价/修改报价
     */
    @Override
    protected Result createSupply(StandardSupplyCreateParam param) {
        // 获取完整参数（因为无法变更父类的属性，所以无法接收对象/集合属性的扩展参数）
        StandardSupplyCreateParamImpl params = param.getOriginalParam(StandardSupplyCreateParamImpl.class);
        // 获取对象属性的完整参数
        Long attr = param.getOriginalParamAttr("orgId", Long.class);
        // 获取集合属性的完整参数
        List<StandardSupplyCreateParamImpl.MaterialImpl> attrs = param.getOriginalParamAttrs("materialList", StandardSupplyCreateParamImpl.MaterialImpl.class);
        // 业务操作
        System.out.println(JsonUtil.toString(param));
        System.out.println(JsonUtil.toString(params));
        System.out.println(JsonUtil.toString(attr));
        System.out.println(JsonUtil.toString(attrs));
        // 返回结果
        return Result.SUCCESS;
    }

    @Override
    protected Result cancelSupply(StandardSupplyCancelParam param) {
        return null;
    }

    @Override
    protected Result updateSupplyFile(StandardSupplyFileUpdateParam param) {
        return null;
    }

    @Override
    protected Result confirmOrder(StandardOrderConfirmParam param) {
        return null;
    }

    @Override
    protected Result createDeliver(StandardOrderDeliverParam param) {
        return null;
    }

    @Override
    protected Result applyPurchaserAccess(String param) {
        return null;
    }


}